<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content=
    "application/xhtml+xml; charset=iso-8859-1" />
    <title>
      Apache-2.4.43
    </title>
    <link rel="stylesheet" type="text/css" href="../stylesheets/lfs.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="stylesheet" href="../stylesheets/lfs-print.css" type=
    "text/css" media="print" />
  </head>
  <body class="blfs" id="blfs-2020-04-02">
    <div class="navheader">
      <h4>
        Beyond Linux<sup>�</sup> From Scratch <span class="phrase">(System
        V</span> Edition) - Version 2020-04-02
      </h4>
      <h3>
        Chapter&nbsp;20.&nbsp;Major Servers
      </h3>
      <ul>
        <li class="prev">
          <a accesskey="p" href="majorservers.html" title=
          "Major Servers">Prev</a>
          <p>
            Major Servers
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="bind.html" title="BIND-9.16.1">Next</a>
          <p>
            BIND-9.16.1
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="majorservers.html" title=
          "Chapter&nbsp;20.&nbsp;Major Servers">Up</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Beyond Linux� From Scratch     (System V Edition) - Version 2020-04-02">
          Home</a>
        </li>
      </ul>
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <h1 class="sect1">
        <a id="apache" name="apache"></a>Apache-2.4.43
      </h1>
      <div class="package" lang="en" xml:lang="en">
        <h2 class="sect2">
          Introduction to Apache HTTPD
        </h2>
        <p>
          The <span class="application">Apache HTTPD</span> package contains
          an open-source HTTP server. It is useful for creating local
          intranet web sites or running huge web serving operations.
        </p>
        <p>
          This package is known to build and work properly using an LFS-9.1
          platform.
        </p>
        <h3>
          Package Information
        </h3>
        <div class="itemizedlist">
          <ul class="compact">
            <li class="listitem">
              <p>
                Download (HTTP): <a class="ulink" href=
                "https://archive.apache.org/dist/httpd/httpd-2.4.43.tar.bz2">https://archive.apache.org/dist/httpd/httpd-2.4.43.tar.bz2</a>
              </p>
            </li>
            <li class="listitem">
              <p>
                Download MD5 sum: 791c986b1e70fe61eb44060aacc89a64
              </p>
            </li>
            <li class="listitem">
              <p>
                Download size: 6.8 MB
              </p>
            </li>
            <li class="listitem">
              <p>
                Estimated disk space required: 88 MB
              </p>
            </li>
            <li class="listitem">
              <p>
                Estimated build time: 0.4 SBU (Using parallelism=4)
              </p>
            </li>
          </ul>
        </div>
        <h3>
          Additional Downloads
        </h3>
        <div class="itemizedlist">
          <ul class="compact">
            <li class="listitem">
              <p>
                Required patch: <a class="ulink" href=
                "http://www.linuxfromscratch.org/patches/blfs/svn/httpd-2.4.43-blfs_layout-1.patch">
                http://www.linuxfromscratch.org/patches/blfs/svn/httpd-2.4.43-blfs_layout-1.patch</a>
              </p>
            </li>
          </ul>
        </div>
        <h3>
          Apache HTTPD Dependencies
        </h3>
        <h4>
          Required
        </h4>
        <p class="required">
          <a class="xref" href="../general/apr-util.html" title=
          "Apr-Util-1.6.1">Apr-Util-1.6.1</a> and <a class="xref" href=
          "../general/pcre.html" title="PCRE-8.44">PCRE-8.44</a>
        </p>
        <h4>
          Optional
        </h4>
        <p class="optional">
          <a class="xref" href="../general/brotli.html" title=
          "brotli-1.0.7">Brotli-1.0.7</a>, <a class="xref" href="db.html"
          title="Berkeley DB-5.3.28">Berkeley DB-5.3.28</a>, <a class="xref"
          href="../general/doxygen.html" title=
          "Doxygen-1.8.17">Doxygen-1.8.17</a>, <a class="xref" href=
          "../general/libxml2.html" title=
          "libxml2-2.9.10">libxml2-2.9.10</a>, <a class="xref" href=
          "../general/lua.html" title="Lua-5.3.5">Lua-5.3.5</a>, <a class=
          "xref" href="../basicnet/lynx.html" title=
          "Lynx-2.8.9rel.1">Lynx-2.8.9rel.1</a> or <a class="xref" href=
          "../basicnet/links.html" title="Links-2.20.2">Links-2.20.2</a> or
          <a class="ulink" href="http://elinks.or.cz">ELinks</a>, <a class=
          "xref" href="../basicnet/nghttp2.html" title=
          "nghttp2-1.40.0">nghttp2-1.40.0</a>, <a class="xref" href=
          "openldap.html" title="OpenLDAP-2.4.49">OpenLDAP-2.4.49</a>
          (<a class="xref" href="../general/apr-util.html" title=
          "Apr-Util-1.6.1">Apr-Util-1.6.1</a> needs to be installed with ldap
          support), <a class="xref" href="../basicnet/rsync.html" title=
          "rsync-3.1.3">rsync-3.1.3</a>, and <a class="ulink" href=
          "https://sourceforge.net/projects/distcache">Distcache</a>
        </p>
        <p class="usernotes">
          User Notes: <a class="ulink" href=
          "http://wiki.linuxfromscratch.org/blfs/wiki/apache">http://wiki.linuxfromscratch.org/blfs/wiki/apache</a>
        </p>
      </div>
      <div class="installation" lang="en" xml:lang="en">
        <h2 class="sect2">
          Installation of Apache HTTPD
        </h2>
        <p>
          For security reasons, running the server as an unprivileged user
          and group is strongly encouraged. Create the following group and
          user using the following commands as <code class=
          "systemitem">root</code>:
        </p>
        <pre class="root">
<kbd class="command">groupadd -g 25 apache &amp;&amp;
useradd -c "Apache Server" -d /srv/www -g apache \
        -s /bin/false -u 25 apache</kbd>
</pre>
        <p>
          Build and install <span class="application">Apache HTTPD</span> by
          running the following commands:
        </p>
        <pre class="userinput">
<kbd class=
"command">patch -Np1 -i ../httpd-2.4.43-blfs_layout-1.patch             &amp;&amp;

sed '/dir.*CFG_PREFIX/s@^@#@' -i support/apxs.in              &amp;&amp;

./configure --enable-authnz-fcgi                              \
            --enable-layout=BLFS                              \
            --enable-mods-shared="all cgi"                    \
            --enable-mpms-shared=all                          \
            --enable-suexec=shared                            \
            --with-apr=/usr/bin/apr-1-config                  \
            --with-apr-util=/usr/bin/apu-1-config             \
            --with-suexec-bin=/usr/lib/httpd/suexec           \
            --with-suexec-caller=apache                       \
            --with-suexec-docroot=/srv/www                    \
            --with-suexec-logfile=/var/log/httpd/suexec.log   \
            --with-suexec-uidmin=100                          \
            --with-suexec-userdir=public_html                 &amp;&amp;
make</kbd>
</pre>
        <p>
          This package does not come with a test suite.
        </p>
        <p>
          Now, as the <code class="systemitem">root</code> user:
        </p>
        <div class="admon note">
          <img alt="[Note]" src="../images/note.png" />
          <h3>
            Note
          </h3>
          <p>
            This package does not install properly using <code class=
            "envar">DESTDIR</code> techniques as an unpriviledged user.
          </p>
        </div>
        <pre class="root">
<kbd class="command">make install  &amp;&amp;

mv -v /usr/sbin/suexec /usr/lib/httpd/suexec &amp;&amp;
chgrp apache           /usr/lib/httpd/suexec &amp;&amp;
chmod 4754             /usr/lib/httpd/suexec &amp;&amp;

chown -v -R apache:apache /srv/www</kbd>
</pre>
      </div>
      <div class="commands" lang="en" xml:lang="en">
        <h2 class="sect2">
          Command Explanations
        </h2>
        <p>
          <span class="command"><strong>sed
          '/dir.*CFG_PREFIX/s@^@#@'...</strong></span>: Forces the
          <span class="application">apxs</span> utility to use absolute
          pathnames for modules, when instructed to do so.
        </p>
        <p>
          <em class="parameter"><code>--enable-authnz-fcgi</code></em>: Build
          FastCGI authorizer-based authentication and authorization
          (mod_authnz_fcgi.so fast CGI module).
        </p>
        <p>
          <em class="parameter"><code>--enable-mods-shared="all
          cgi"</code></em>: The modules should be compiled and used as
          Dynamic Shared Objects (DSOs) so they can be included and excluded
          from the server using the run-time configuration directives.
        </p>
        <p>
          <em class="parameter"><code>--enable-mpms-shared=all</code></em>:
          This switch ensures that all MPM (Multi Processing Modules) are
          built as Dynamic Shared Objects (DSOs), so the user can choose
          which one to use at runtime.
        </p>
        <p>
          <em class="parameter"><code>--enable-suexec</code></em>: This
          switch enables building of the <span class=
          "application">Apache</span> suEXEC module which can be used to
          allow users to run CGI and SSI scripts under user IDs different
          from the user ID of the calling web server.
        </p>
        <p>
          <em class="parameter"><code>--with-suexec-*</code></em>: These
          switches control suEXEC module behavior, such as default document
          root, minimal UID that can be used to run the script under the
          suEXEC. Please note that with minimal UID 100, you can't run CGI or
          SSI scripts under suEXEC as the <code class=
          "systemitem">apache</code> user.
        </p>
        <p>
          <span class="command"><strong>...
          /usr/lib/httpd/suexec</strong></span>: These commands put
          <span class="command"><strong>suexec</strong></span> wrapper into
          proper location, since it is not meant to be run directly. They
          also adjust proper permissions of the binary, making it setgid
          <code class="systemitem">apache</code>.
        </p>
        <p>
          <span class="command"><strong>chown -R apache:apache
          /srv/www</strong></span>: By default, the installation process
          installs files (documentation, error messages, default icons, etc.)
          with the ownership of the user that extracted the files from the
          tar file. If you want to change the ownership to another user, you
          should do so at this point. The only requirement is that the
          document directories need to be accessible by the <span class=
          "command"><strong>httpd</strong></span> process with (r-x)
          permissions and files need to be readable (r--) by the <code class=
          "systemitem">apache</code> user.
        </p>
      </div>
      <div class="configuration" lang="en" xml:lang="en">
        <h2 class="sect2">
          Configuring Apache
        </h2>
        <div class="sect3" lang="en" xml:lang="en">
          <h3 class="sect3">
            <a id="apache-config" name="apache-config"></a>
          </h3>
          <h4 class="title">
            <a id="apache-config" name="apache-config"></a>Config Files
          </h4>
          <p>
            <code class="filename">/etc/httpd/httpd.conf</code> and
            <code class="filename">/etc/httpd/extra/*</code>
          </p>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <h3 class="sect3"></h3>
          <h4 class="title">
            <a id="idm140006438303344" name=
            "idm140006438303344"></a>Configuration Information
          </h4>
          <p>
            See <a class="ulink" href=
            "file:///usr/share/httpd/manual/configuring.html">file:///usr/share/httpd/manual/configuring.html</a>
            for detailed instructions on customising your <span class=
            "application">Apache</span> HTTP server configuration file.
          </p>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <h3 class="sect3">
            <a id="httpd-init" name="httpd-init"></a>
          </h3>
          <h4 class="title">
            <a id="httpd-init" name="httpd-init"></a><span class=
            "phrase">Boot Script</span>
          </h4>
          <p>
            If you want the <span class="application">Apache</span> server to
            start automatically when the system is booted, install the
            <span class="phrase"><code class=
            "filename">/etc/rc.d/init.d/httpd</code> init script</span>
            included in the <a class="xref" href=
            "../introduction/bootscripts.html" title=
            "BLFS Boot Scripts">blfs-bootscripts-20191204</a> package:
          </p>
          <pre class="root">
<kbd class="command">make install-httpd</kbd>
</pre>
        </div>
      </div>
      <div class="content" lang="en" xml:lang="en">
        <h2 class="sect2">
          Contents
        </h2>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong class="segtitle">Installed Programs:</strong>
              <span class="segbody">ab, apachectl, apxs, checkgid, dbmmanage,
              fcgistarter, htcacheclean, htdbm, htdigest, htpasswd, httpd,
              httxt2dbm, logresolve, rotatelogs, and suexec</span>
            </div>
            <div class="seg">
              <strong class="segtitle">Installed Libraries:</strong>
              <span class="segbody">Several libraries under
              /usr/lib/httpd/modules/</span>
            </div>
            <div class="seg">
              <strong class="segtitle">Installed Directories:</strong>
              <span class="segbody">/etc/httpd, /srv/www, /usr/include/httpd,
              /usr/lib/httpd, /usr/share/httpd, /var/log/httpd, and
              /var/run/httpd</span>
            </div>
          </div>
        </div>
        <div class="variablelist">
          <h3>
            Short Descriptions
          </h3>
          <table border="0" class="variablelist">
            <colgroup>
              <col align="left" valign="top" />
              <col />
            </colgroup>
            <tbody>
              <tr>
                <td>
                  <p>
                    <a id="ab" name="ab"></a><span class="term"><span class=
                    "command"><strong>ab</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is a tool for benchmarking your <span class=
                    "application">Apache</span> HTTP server.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="apachectl" name="apachectl"></a><span class=
                    "term"><span class=
                    "command"><strong>apachectl</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is a front end to the <span class=
                    "application">Apache</span> HTTP server which is designed
                    to help the administrator control the functioning of the
                    <span class="application">Apache</span> httpd daemon.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="apxs" name="apxs"></a><span class=
                    "term"><span class=
                    "command"><strong>apxs</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is a tool for building and installing extension modules
                    for the <span class="application">Apache</span> HTTP
                    server.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="checkgid" name="checkgid"></a><span class=
                    "term"><span class=
                    "command"><strong>checkgid</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is a program that checks whether it can setgid to the
                    group specified. This is to see if it is a valid group
                    for Apache2 to use at runtime. If the user (should be run
                    as superuser) is in that group, or can setgid to it, it
                    will return 0.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="dbmmanage" name="dbmmanage"></a><span class=
                    "term"><span class=
                    "command"><strong>dbmmanage</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used to create and update the DBM format files used to
                    store usernames and passwords for basic authentication of
                    HTTP users.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="fcgistarter" name="fcgistarter"></a><span class=
                    "term"><span class=
                    "command"><strong>fcgistarter</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is a tool to start a FastCGI program.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="htcacheclean" name="htcacheclean"></a><span class=
                    "term"><span class=
                    "command"><strong>htcacheclean</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used to clean up the disk cache.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="htdbm" name="htdbm"></a><span class=
                    "term"><span class=
                    "command"><strong>htdbm</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used to manipulate the DBM password databases.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="htdigest" name="htdigest"></a><span class=
                    "term"><span class=
                    "command"><strong>htdigest</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used to create and update the flat-files used to store
                    usernames, realms and passwords for digest authentication
                    of HTTP users.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="htpasswd" name="htpasswd"></a><span class=
                    "term"><span class=
                    "command"><strong>htpasswd</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used to create and update the flat-files used to store
                    usernames and passwords for basic authentication of HTTP
                    users.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="httpd" name="httpd"></a><span class=
                    "term"><span class=
                    "command"><strong>httpd</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is the <span class="application">Apache</span> HTTP
                    server program.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="httxt2dbm" name="httxt2dbm"></a><span class=
                    "term"><span class=
                    "command"><strong>httxt2dbm</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used to generate DBM files from text, for use in
                    RewriteMap.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="logresolve" name="logresolve"></a><span class=
                    "term"><span class=
                    "command"><strong>logresolve</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is a post-processing program to resolve IP-addresses in
                    <span class="application">Apache</span>'s access log
                    files.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="rotatelogs" name="rotatelogs"></a><span class=
                    "term"><span class=
                    "command"><strong>rotatelogs</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is a simple program for use in conjunction with
                    <span class="application">Apache</span>'s piped log file
                    feature.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="suexec" name="suexec"></a><span class=
                    "term"><span class=
                    "command"><strong>suexec</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    allows users to run CGI and SSI applications as a
                    different user.
                  </p>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
      <p class="updated">
        Last updated on 2020-04-01 15:04:19 -0500
      </p>
    </div>
    <div class="navfooter">
      <ul>
        <li class="prev">
          <a accesskey="p" href="majorservers.html" title=
          "Major Servers">Prev</a>
          <p>
            Major Servers
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="bind.html" title="BIND-9.16.1">Next</a>
          <p>
            BIND-9.16.1
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="majorservers.html" title=
          "Chapter&nbsp;20.&nbsp;Major Servers">Up</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Beyond Linux� From Scratch     (System V Edition) - Version 2020-04-02">
          Home</a>
        </li>
      </ul>
    </div>
  </body>
</html>
